/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts.comment.reportComment;

import com.myapp.model.DAO.Comments.CommentsDao;
import com.myapp.model.comentarios.Comentarios;
import com.myapp.model.estados.Estados;
import com.myapp.model.usuarios.Usuarios;
import com.myapp.svc.comentarios.ComentariosSvc;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.stream.events.Comment;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author Tarde
 */
public class ReportCommentAction extends org.apache.struts.action.Action {

    /* forward name="success" path="" */
    private static final String SUCCESS = "success";

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        HttpSession session=request.getSession();
        Comentarios com=new Comentarios();
        Estados est = new Estados();
        ComentariosSvc comSvc=new ComentariosSvc();
        Usuarios usr=new Usuarios();
        usr=(Usuarios) session.getAttribute("usuarios");
        String idComentario=request.getParameter("idComentario");
        com=comSvc.listarPorId(idComentario);
        est.setIdestado(Byte.valueOf("6"));
        com.setEstados(est);
        comSvc.reportarComments(com);
        
        return mapping.findForward(SUCCESS);
    }
}
